<?php
/**
 *      [Jsen.net] (C)2013-2099 Jason Group Science and technology co., LTD.
 *      This is NOT a freeware, use is subject to license terms
 * 
 *      http://www.jsen.net
 *      tel:400-681-9511
 */
class UserWithdrawModel extends SystemModel {

    public function lists() {
    	$sqlmap = array();
    	if ($_GET['keyword']) {
    		$map = array();
    		$map['username'] = array('LIKE',"%".trim($_GET['keyword'])."%");
    		$ids = model('user')->where($map)->getField('id',TRUE);
    		$sqlmap['a.uid'] = array('IN',$ids);
    	}
		if($_GET["start"]!="" or $_GET["end"]!=""){
				$start = strtotime($_GET['start'].' 00:00:00');
				$end = strtotime($_GET['end'].' 23:59:59');
				$sqlmap['a.add_time'] =array('between',$start.','.$end);
			}
			
			if ($_GET["status"]!="") {
				$sqlmap['a.withdraw_status'] = $_GET["status"]-1;
			}
		$field = "a.*,f.username,f.true_name,f.idcard,f.bankaddress,f.banknum,f.freeze_money,f.pay_points,f.user_money";
    	$infos = M("user_withdraw a")->field($field)->where($sqlmap)->join(" LEFT JOIN  __USER__ as f ON a.uid=f.id")->order('a.id DESC')->limit(($_GET['pagenum']-1)*$_GET['rowsnum'].','.$_GET['rowsnum'])->select();
    	
    	return $infos;
    }

}